package com.neusoft.mapper;

import com.neusoft.domain.TransactionRecordPO;
import com.neusoft.domain.VirtualWalletPO;
import org.apache.ibatis.annotations.*;

import java.math.BigDecimal;

@Mapper
public interface AdminWalletMapper {
    @Select("SELECT * FROM wallets WHERE id = #{walletId}")
    VirtualWalletPO findById(@Param("walletId") Long walletId);

    @Update("UPDATE wallets SET balance = #{balance} WHERE id = #{walletId}")
    void updateBalance(@Param("walletId") Long walletId, @Param("balance") BigDecimal balance);

    @Insert("INSERT INTO transaction_record (wallet_id, amount, type, timestamp) VALUES (#{walletId}, #{amount}, #{type}, #{timestamp})")
    void insertTransactionRecord(TransactionRecordPO record);
}